

******** 2017 June Elections 


clear all
cd "${data}"

import delimited "monthly_agendas.csv"


 keep if country_name == "uk"
 keep party month month_start month_end party_sum
 keep if month > 201606 & month < 201813
 
 gen time = .
 replace time = 1 if month== 201607
 replace time = 2 if month== 201608
 replace time = 3 if month== 201609
 replace time = 4 if month== 201610
 replace time = 5 if month== 201611
 replace time = 6 if month== 201612
 replace time = 7 if month== 201701
 replace time = 8 if month== 201702
 replace time = 9 if month== 201703
 replace time = 10 if month== 201704
 replace time = 11 if month== 201705
 replace time = 12 if month== 201706
 replace time = 13 if month== 201707
 replace time = 14 if month== 201708
 replace time = 15 if month== 201709
 replace time = 16 if month== 201710
 replace time = 17 if month== 201711
 replace time = 18 if month== 201712
 replace time = 19 if month== 201801
 replace time = 20 if month== 201802
 replace time = 21 if month== 201803
 replace time = 22 if month== 201804
 replace time = 23 if month== 201805
 replace time = 24 if month== 201806
 replace time = 25 if month== 201807
 replace time = 26 if month== 201808
 replace time = 27 if month== 201809
 replace time = 28 if month== 201810
 replace time = 29 if month== 201811
 replace time = 30 if month== 201812

label define timelabels 1"2016 Jul" 2"2016 Aug" 3"2016 Sep" 4"2016 Oct" 5"2016 Nov" 6"2016 Dec" 7"2017 Jan" 8"2017 Feb" 9"2017 Mar" 10"2017 Apr" 11"2017 May" 12"2017 Jun" 13"2017 Jul" 14"2017 Aug" 15"2017 Sep" 16"2017 Oct" 17"2017 Nov" 18"2017 Dec" 19"2018 Jan" 20"2018 Feb" 21"2018 Mar" 22"2018 Apr" 23"2018 May" 24"2018 Jun" 25"2018 Jul" 26"2018 Aug" 27"2018 Sep" 28"2018 Oct" 29"2018 Nov" 30"2018 Dec"
label values time timelabels

 duplicates drop 
 encode party, generate(party_)
 tsset party_ time
 
collapse (sum) party_sum, by(time)
tsset time
tsline party_sum, title("United Kingdom 2017") xtitle("") ytitle("") ylabel(,labsize(tiny) angle(horizontal)) xlabel(1(1)30, valuelabel angle(vertical) labsize(tiny)) xline(12, lpattern(dash) lcolor(cranberry))

graph save "${figures}/UK2017.gph", replace


***** 2015 May General Elections


clear all
cd "${data}"

import delimited "monthly_agendas.csv"


 keep if country_name == "uk"
 keep party month month_start month_end party_sum
 keep if month > 201405 & month < 201607

 
 gen time = .
 replace time = 1 if month== 201406
 replace time = 2 if month== 201407
 replace time = 3 if month== 201408
 replace time = 4 if month== 201409
 replace time = 5 if month== 201410
 replace time = 6 if month== 201411
 replace time = 7 if month== 201412
 replace time = 8 if month== 201501
 replace time = 9 if month== 201502
 replace time = 10 if month== 201503
 replace time = 11 if month== 201504
 replace time = 12 if month== 201505
 replace time = 13 if month== 201506
 replace time = 14 if month== 201507
 replace time = 15 if month== 201508
 replace time = 16 if month== 201509
 replace time = 17 if month== 201510
 replace time = 18 if month== 201511
 replace time = 19 if month== 201512
 replace time = 20 if month== 201601
 replace time = 21 if month== 201602
 replace time = 22 if month== 201603
 replace time = 23 if month== 201604
 replace time = 24 if month== 201605
 replace time = 25 if month== 201606


label define timelabels 1"2014 Jun" 2"2014 Jul" 3"2014 Aug" 4"2014 Sep" 5"2014 Oct" 6"2014 Nov" 7"2014 Dec" 8"2015 Jan" 9"2015 Feb" 10"2015 Mar" 11"2015 Apr" 12"2015 May" 13"2015 Jun" 14"2015 Jul" 15"2015 Aug" 16"2015 Sep" 17"2015 Oct" 18"2015 Nov" 19"2015 Dec" 20"2016 Jan" 21"2016 Feb" 22"2016 Mar" 23"2016 Apr" 24"2016 May" 25"2016 Jun"
label values time timelabels

 duplicates drop 
 encode party, generate(party_)
 tsset party_ time
 
collapse (sum) party_sum, by(time)
tsset time
tsline party_sum, title("United Kingdom 2015") xtitle("") ytitle("") ylabel(,labsize(tiny) angle(horizontal)) xlabel(1(1)25, valuelabel angle(vertical) labsize(tiny)) xline(12, lpattern(dash) lcolor(cranberry))

graph save "${figures}/UK2015.gph", replace

cd "${figures}"

graph combine UK2015.gph UK2017.gph, ycommon rows(1) xsize(25) ysize(15) l1("party press release")
graph save "${figures}/figureQ2.gph", replace
graph export "${figures}/figureQ2.png", replace

